<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery-3.4.1.min.js"></script>
    <script>
        $(function(){
            let stuno=window.sessionStorage.getItem("stuno");
            if(!stuno){
                window.history.back();
                return false;
            }
            $("form input").attr("readonly",true);
            $("form :submit,form :radio,form select,form :file").attr("disabled",true);

            $.ajax({
                method:"get",
                url:"student/get/"+stuno,
                beforeSend:function(xhr){
                    xhr.setRequestHeader("token",window.sessionStorage.getItem("token")||{});
                },
                success:function (stu) {
                    s=stu.data;
                    //$("input[name=sname]").val(s["sname"]);

                    for(p in stu.data){
                        $("form [name="+p+"]").val(s[p]);
                    }
                }
            })
        });
    </script>
</head>
<body>
<form method="post" action="add"  enctype="multipart/form-data">
    <fieldset>
        <label>课程信息</label>
        <p>
            <input type="text" required name="sname" placeholder="姓名" />
            性别<input type="radio" required name="sex" placeholder="性别" value="男" checked/>男
            <input type="radio" required name="sex" placeholder="性别" value="女"/>女
            <input type="text" required name="telephone" placeholder="电话号码" />
            <input type="text" required name="qq" placeholder="qq" />
            <input type="text" required name="wechat" placeholder="微信" />
            <input type="text" required name="fromcity" placeholder="城市" />
            <input type="text" required name="address" placeholder="住址" />
            <input type="text" required name="pass" placeholder="密码" />
            <input type="file" required name="idcardpic2"  placeholder="身份证号" />
            <br/>
        <p> 入学时间:<input type="date" required name="enterdate" placeholder="入学时间" /> </p>
        <p> 出生日期:<input type="date" required name="birthday" placeholder="出生日期" /> </p>
        <p> 年级：<select name="gradeid">
            <option value="1">java</option>
            <option value="6">.net</option>
            <option value="15">高二</option>
        </select>
        </p>
        </p>
        <p>
            <input type="submit" value="保存"/>
            <input type="button" value="返回" onclick="javascript:history.back();"/>
        </p>
    </fieldset>
</form>
</body>
</html>